import React from 'react'
import { View, Text, StyleSheet } from 'react-native'
import uuid from 'uuid'
import Collection from './Collection';
import { ListFresh } from '../../components'


const CollectionList = (props) => {
  const { user, dispatch, app } = props
  const { collectionList } = app
  return (
    <View>
      {
        !user ? <Text>您尚未登录，请先登录</Text> :
        <ListFresh
          key={uuid()}
          dataSource={collectionList}
          dispatch={dispatch}
          currentUser={user}
          RenderChild={Collection}
          onReFresh={() => dispatch({ type: 'app/loadCollection' })}
        />
      }
    </View>
  )
}

export default CollectionList
